var XMas = {};
XMas.Config ={};
XMas.soundBackground =[];
XMas.backgroundMusic = {};
XMas.gift_clickedSound = [];
XMas.santa_Incorrect = [];
XMas.santa_Correct = [];
XMas.backgroundLevelUp = null;

XMas.Boot = function (game) { };
XMas.Boot.prototype = {
    preload: function () {
        this.cache.removeJSON('config');
        // preload the loading indicator first before anything else
        this.load.spritesheet('preloaderBar', 'assets/loading.png', 226, 16, 10);
        this.load.image("bg_loading", "assets/bg_loading.jpg");
        this.load.json('config', 'Configs/gameConfigs.json');
        XMas.Util.getBestScore(this);
    },
    create: function() {
        // set scale options
        this.input.maxPointers = 1;
        this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
        this.scale.pageAlignHorizontally = true;
        this.scale.pageAlignVertically = true;
        this.scale.setScreenSize(true);
        XMas.Config = this.cache.getJSON('config').gameConfigs;
        //get random of number
        var rdArray = this.rnd.integerInRange(1, XMas.Config.setting.sounds.length);
        //push it into array 
        XMas.soundBackground.push(XMas.Config.setting.sounds[rdArray - 1].soundUrl);
        XMas.Config.setting.sounds.forEach(function (item) {
            //check it because it pushed before run forEach 
            if (item.keyID != rdArray)
                XMas.soundBackground.push(item.soundUrl);
        });
        
        this.state.start('Preloader');
    }
}

